package com.xinyi;

/**
 * @desc:
 * @author: Shoko
 * @date: 2025/3/13
 */
public class Client {
    public static void main(String[] args) {
        // 创建数据库提供者
        IDatabaseProvider databaseProvider = new DatabaseProvider();
        databaseProvider.connection("jdbc:mysql://localhost:3306/e3_q2");

        // 创建 API 提供者
        IThirdpartyAPIProvider apiProvider = new APIProvider();
        // 用户认证
        IThirdpartyAuthenticationProvider authProvider = new QQAuth();
        // 创建服务
        Service service = new Service(databaseProvider, apiProvider, authProvider);

        // 执行 SQL 查询
        String token=service.executeSql("SELECT * FROM users where name='zhangsan' and password='123456' ");

        // 调用 API
        service.getDataFromAPI("https://api.example.com/data", "param1=value1");

        // 使用微博认证
        authProvider = new WeiboAuth();
        service.login(token);
    }
}

